package com.example.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * 	过滤器组建注册的方式
 * 
 * @author yzl
 *
 */
public class ServletFilter2 implements Filter {

	@Override
	public void destroy() {
		System.out.println("组建注册方式*过滤器被销毁------>");
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
			throws IOException, ServletException {
		long start = System.currentTimeMillis();
		System.out.println("组建注册方式*过滤器正在执行...");
		arg2.doFilter(arg0, arg1);
		System.out.println("Execute cost=" + (System.currentTimeMillis() - start));
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		System.out.println("组建注册方式*初始化过滤器。");
	}

}
